from enum import Enum

try:
    from common import secret
except:
    secret = None

MIDDLE_DB_STR_LEN = 100
LONG_DB_STR_LEN = 500
COMMON_DECIMAL = 4


class OrderType:
    PURCHASE = '采购'
    SALE = '销售'
    CHECK = '盘点'
    INIT_CHECK = '期初盘点'  # 期初
    TRANSFER = '调拨'
    PURCHASE_RETURN = '采购退货'
    SALE_RETURN = '销售退货'


class TransactionType:  # 账户流水类型
    PURCHASE = '采购'
    SALE = '销售'
    PURCHASE_RETURN = '采购退货'
    SALE_RETURN = '销售退货'

    SHOULD_INCOME = '增加应收'
    INCOME = '收款'
    SHOULD_PAYMENT = '增加应付'
    PAYMENT = '付款'


class CustomerType(Enum):
    SUPPLIER = 1
    CLIENT = 2


class OrderStatus:
    DRAFT = '草稿'
    SUCCESS = '已完成'
    REVOKE = '已撤销'


class OrderDraftStatus:
    PENDING = '待处理'
    PRICE = '报价单'


class AccountType(Enum):
    CASH = 1
    BANK_ACCOUNT = 2
    WECHAT_PAY = 3
    ALIPAY = 4
    OTHER = 5


class ActionType(Enum):
    DRAFT = 1
    SUBMIT = 2
    REVOKE = 3


class OrderActionType:
    SAVE_DRAFT = '保存草稿'
    SUBMIT = '提交'
    REVOKE = '撤销'


class LoginType:
    ACCOUNT = 'account'
    PHONE = 'phone'


# LoginType.ACCOUNT.label = 'account'
# LoginType.PHONE.label = 'phone'


class SkuBatchAction(Enum):
    ACTIVE = 1  # 批量启用
    UPDATE_PRICE = 2  # 批量改价


class CoinUseAction:
    USE_COUPON = {
        "name": '使用兑换券'
    }

    ADD_SPU = {
        "name": '添加商品',
        'coin_use': 1
    }

    ADD_CATEGORY = {
        "name": '添加类别',
        'coin_use': 1
    }

    ADD_ORDER = {
        "name": '开单',
        'coin_use': 1
    }


class IsExistType(Enum):
    USER_PHONE = 1
    USER_USERNAME = 2
    ROLE_NAME = 3


class CouponCoinType:
    choices = [100, 200, 500, 1000]
    one = 100
    two = 200
    five = 500
    ten = 1000


class FileType:
    IMG = 1
    BINARY = 2  # 文件


class ImgType:
    GALLERY = 1  # 图库图片
    ELEMENT = 2  # 单属于某个元素


class FileBelongType:
    SPU = 'spu'
    SKU = 'sku'
    PURCHASE_ORDER = 'purchase_order'
    SALE_ORDER = 'sale_order'
    CHECK_ORDER = 'check_order'
    TRANSFER_ORDER = 'transfer_order'


IMAGE_URL_BASE = '/api/file/files/{}/{}'  # dev  // https://szr.faceunity.com/

USER_FILE_BASE_FOLDER_PATH = "file/my_files/"


class OperationLogType:
    SPU = '商品'
    SKU = '单品'
    ORDER = '单据'
    USER = '员工'
    CUSTOMER = '客户'

    ALL = [SPU, ORDER, USER, CUSTOMER]


class OperationAction:
    CREATE = '创建'
    SAVE_DRAFT = '保存草稿'
    TO_REVIEW = '提交审核'
    CANCEL_REVIEW = '取消审核'
    PASS = '审核通过'
    REJECT = '审核驳回'
    ACTIVE = '启用'
    DE_ACTIVE = '停用'
    DELETE = '删除'

    PUT_ALL = [SAVE_DRAFT, TO_REVIEW, CANCEL_REVIEW, PASS, REJECT, ACTIVE, DE_ACTIVE]
    ALL = [CREATE, DELETE] + PUT_ALL


class MessageType:
    SYSTEM = '系统消息'
    TODO = '待办消息'


class GetMessageType:
    SENDER = 'sender'
    RECEIVER = 'receiver'


if __name__ == '__main__':
    print(type(IsExistType.USER_PHONE.value))
